package com.hqd.ch03.v27.factory.config;

public class RuntimeBeanReference implements BeanReference {

    private final String beanName;

    private final Class<?> beanType;

    private final boolean toParent;


    public RuntimeBeanReference(String beanName) {
        this(beanName, false);
    }

    public RuntimeBeanReference(String beanName, boolean toParent) {
        this.beanName = beanName;
        this.beanType = null;
        this.toParent = toParent;
    }

    public RuntimeBeanReference(Class<?> beanType) {
        this(beanType, false);
    }

    public RuntimeBeanReference(Class<?> beanType, boolean toParent) {
        this.beanName = beanType.getName();
        this.beanType = beanType;
        this.toParent = toParent;
    }


    @Override
    public String getBeanName() {
        return this.beanName;
    }

    public Class<?> getBeanType() {
        return this.beanType;
    }

    public boolean isToParent() {
        return this.toParent;
    }

}
